输入:杨辉三角的高度height
输出:以金字塔形式打印出杨辉三角的前height行
#include <stdlib.h>
int main(int argc,char **argv)
{
int height;
printf("请输入杨辉三角的高度\n");
scanf("%d",&height);
int **array=(int **)malloc(sizeof(int *)*height); //动态生成二维数组
for(int i=0;i<height;i++)
{
array[i]=(int *)malloc(sizeof(int)*height);
}
int row,col;
for(row=0;row<height;row++)
{
for(col=0;col<(height-row);col++) //填充空格,使输出为金字塔形式
{
printf(" ");
}
for(col=0;col<=row;col++)
{
if(col==0||row==col)
{
arr